Fixing elementwise absolute value operation on UserTypes#23
Fixing elementwise absolute value operation on UserTypes#23inducer merged 3 commits intoinducer:mainfrom
Conversation
inducer
left a comment
There was a problem hiding this comment.
I said I'd left comments during the meeting. Turns out that was only half-true. Typed them in, but not yet submitted them. Sorry!
test/test_codegen_fortran.py
Outdated
| cb("<state>ytype", "y") | ||
| # Test new builtin on a usertype. | ||
| cb("z", "<builtin>elementwise_abs(<state>ytype)") | ||
| with cb.if_("z[1] > 2"): |
There was a problem hiding this comment.
It looks like this is indexing into a user type, which wouldn't be allowed. Can you help me understand? If you'd like to assert something about the internal state of a user type, it should be done in Fortran.
There was a problem hiding this comment.
Yeah, this is a fair point. Obviously given the inadequacy of the previous version of the test I wanted to make sure I'm checking the result when the function is applied to scalars, arrays, and usertypes, but without indexing into the UserType (which is just an array) I'm not sure how to check it. Can you explain what you mean by the last part of your comment?
There was a problem hiding this comment.
Nvm - I think I did what makes more sense in 0237e4d. (Let me know if this isn't what you meant)
than in the outer Fortran test code
|
LGTM, thanks! |
An effort to fix a previous erroneous attempt at elementwise absolute values (see #20). This new PR features tests that actually check that the absolute values are being properly calculated using this builtin for scalars, arrays, and UserTypes.